#!/usr/bin/python3.8.9
# -*- coding: utf-8 -*-

# @Author  : Tina Yu
# @Time    : 2021-7-8 16:01
from flask import Flask, request, session

app = Flask(__name__)
app.secret_key = "tina_yu"


@app.route("/")
def hello_world():
    app.logger.info("success")
    return "<p>Hello, World!</p>"


@app.route('/login', methods=['get', 'post'])
def login():
    res = {
        'url': request.path,
        'method': request.method,
        'args': request.args,
        'form': request.form
    }
    session['username'] = request.args.get('name')
    return res


@app.route('/hello')
def hello():
    return 'Hello, World'


if __name__ == '__main__':
    app.run(debug=True, port=8000)
